home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / asm / DvPkMacros.readme < prev    next >
Encoding:
Text File  |  1997-09-05  |  5.3 KB  |  184 lines

  1. Short:    Lots of useful macros 4 the DevPac
  2. Author:   thor@math.tu-berlin.de (Thomas Richter)
  3. Uploader: thor@math.tu-berlin.de (Thomas Richter)
  4. Type:     dev/asm
  5.  
  6. This is a set of extremly useful macros for the DevPac assembler. It contains
  7. macros for:
  8.  
  9. -automatic stack management that nest
  10. -for/next do/repeat/loop loops with break/cont instructions that nest
  11. -support for stack based (C-style) functions
  12. -support for auto variables that are kept on the stack
  13. -support for longword bitfields
  14. -string support
  15. -register saving/loading that nests
  16. -support for tag based functions
  17.  
  18. _____________________________________________________________________________
  19.  
  20. Here's an example code that uses these macros, unbelieveable, but
  21. that's assembly language, too!
  22.  
  23. ShrinkPool:
  24.         saveregs a2
  25.     defvar
  26.      auto.l sp_name,40
  27.     endvar
  28.         
  29.         move.l mn_SysBase(a5),a6
  30.         jsr Forbid(a6)          ;do not disturb
  31.         
  32. .startover:
  33.         move.l mn_SysBase(a5),a6
  34.         move.l $142(a6),a0      ;get Head
  35.         do
  36.          tst.l (a0)             ;really ? 
  37.          break.s eq
  38.  
  39.          btst #4,1+$0e(a0)      
  40.          beq.s .nextouter       
  41.  
  42.          cmp.l #$3000,$1c(a0)   
  43.          blo.s .nextouter
  44.  
  45.          move.l $a(a0),a2
  46.      lea sp_name(a7),a1
  47.      smove a2,a1        ;copy name for later usage
  48.       
  49.          move.l $142(a6),a1     ;*2nd
  50.          do
  51.           tst.l (a1)            ;really ?
  52.           break.s eq
  53.  
  54.           move.l $14(a1),d0
  55.           moveq #$20,d1
  56.           sub.l d1,d0
  57.           cmp.l $18(a0),d0      
  58.           bne.s .nextinner
  59.  
  60.                                 
  61.           move.l $10(a0),d0     
  62.           beq.s .alert          
  63.           do
  64.            move.l d0,a2
  65.            move.l (a2),d0       
  66.           while.s ne            
  67.           cmp.l #$3000,4(a2)
  68.           blo.s .nextinner
  69.           add.l 4(a2),a2        
  70.           cmp.l $18(a0),a2      
  71.           bne.s .nextinner
  72.           
  73.           bsr ShrinkHeaders
  74.           bra.s .startover
  75.  
  76. .nextinner:
  77.           move.l (a1),a1        ;*next
  78.          loop.s
  79. .nextouter:      
  80.          move.l (a0),a0
  81.         loop.s
  82.         bra.s .exit
  83. .alert: 
  84.     lea sp_Name(a7),a0
  85.     saveregs d1-d3
  86.  
  87.     move.l mn_DOSBase(a5),a6
  88.     move.l a0,d2
  89.     strlen a0,d3        ;get length of the string
  90.     jsr Write(a6)
  91.  
  92.     loadregs
  93. .exit:
  94.     move.l mn_SysBase(a5),a6
  95.     jsr Permit(a6)
  96.     
  97.     freevar
  98.     loadregs
  99.     rts
  100.  
  101. _____________________________________________________________________________
  102.  
  103. More on the macros, together with examples is in the "macros.asm" file itself
  104.  
  105. It should propably be stripped before you use it, some of the comments are
  106. rather long.
  107.  
  108. It shows also "creative" usage of some of the DevPac features.
  109. _____________________________________________________________________________
  110.  
  111.                         The THOR-Software Licence
  112.  
  113.  
  114. This License applies to the computer programs known as "Macros.asm".
  115. The "Program", below, refers to such program.
  116.  
  117.  
  118. The programs and files in this distribution are freely distributable
  119. under the restrictions stated below, but are also Copyright (c)
  120. Thomas Richter.
  121.  
  122.  
  123. Distribution of the Program by a commercial organization without written
  124. permission from the author to any third party is prohibited if any payment
  125. is made in connection with such distribution, whether directly
  126. (as in payment for a copy of the Program) or indirectly (as in payment
  127. for some service related to the Program, or payment for some product
  128. or service that includes a copy of the Program "without charge";
  129. these are only examples, and not an exhaustive enumeration of prohibited
  130. activities). However, the following methods of distribution involving
  131. payment shall not in and of themselves be a violation of this restriction:
  132.  
  133.  
  134. (i) Posting the Program on a public access information storage and
  135. retrieval service for which a fee is received for retrieving information
  136. (such as an on-line service), provided that the fee is not
  137. content-dependent (i.e., the fee would be the same for retrieving the same
  138. volume of information consisting of random data).
  139.  
  140.  
  141.  
  142. (ii) Distributing the Program on a CD-ROM, provided that the files
  143. containing the Program are reproduced entirely and verbatim on such
  144. CD-ROM, and provided further that all information on such CD-ROM be
  145. redistributable for non-commercial purposes without charge.
  146.  
  147.  
  148.  
  149. Everything in this distribution must be kept together, in original
  150. and unmodified form.
  151.  
  152.  
  153.  
  154.  
  155. Limitations.
  156.  
  157. THE PROGRAM IS PROVIDED TO YOU "AS IS," WITHOUT WARRANTY. THERE IS NO
  158. WARRANTY FOR THE PROGRAM, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
  159. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
  160. PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS. THE ENTIRE
  161. RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD
  162. THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY
  163. SERVICING, REPAIR OR CORRECTION.
  164.  
  165.  
  166.  
  167. IF YOU DO NOT ACCEPT THIS LICENCE, YOU MUST DELETE ALL FILES CONTAINED IN
  168. THIS ARCHIVE.
  169.  
  170. _____________________________________________________________________________
  171.  
  172. Greetings,
  173.     Thomas
  174.  
  175.  
  176. ============================= Archive contents =============================
  177.  
  178. Original  Packed Ratio    Date     Time    Name
  179. -------- ------- ----- --------- --------  -------------
  180.    27556    6803 75.3% 07-Aug-97 22:27:22 +Macros.asm
  181.     5042    2167 57.0% 07-Aug-97 22:44:20 +Macros.readme
  182. -------- ------- ----- --------- --------
  183.    32598    8970 72.4% 12-Aug-97 04:29:52   2 files
  184.